package listener;

import javax.servlet.ServletRequestEvent;
import javax.servlet.ServletRequestListener;
import javax.servlet.annotation.WebListener;
import java.text.SimpleDateFormat;
import java.util.Date;

//@WebListener
public class 请求创建销毁监听 implements ServletRequestListener {
    @Override
    public void requestDestroyed(ServletRequestEvent servletRequestEvent) {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss");
        System.out.println("请求在"+sdf.format(date)+"被响应了");
    }

    @Override
    public void requestInitialized(ServletRequestEvent servletRequestEvent) {
        Date date = new Date();
        SimpleDateFormat sdf = new SimpleDateFormat("hh:mm:ss");
        System.out.println("请求在"+sdf.format(date)+"被创建啦");
    }
}
